<style type="text/css" title="currentStyle">
	@import "../media/css/demo_table.css";
	@import "media/css/TableTools.css";
</style>

<script type="text/javascript" charset="utf-8" src="../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="media/ZeroClipboard/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8" src="media/js/TableTools.js"></script>
<script type="text/javascript" charset="utf-8">
	$(document).ready( function () {
		/* You might need to set the sSwfPath! Something like:
		 *   TableToolsInit.sSwfPath = "/media/swf/ZeroClipboard.swf";
		 */
		$('#example').dataTable( {
			"sPaginationType": "full_numbers",
			"sDom": 'T<"clear">lfrtip'
		} );

	} );
</script>
<script language="javascript">
var ajax1=new sack();


function checkUser(tableName,condStr,val,id)
{
	
}

function resultCount()
{
  if(ajax1.response > 0 )
  {
  	alert("Data Updated Successfully");
	location.href = '?ch=viewClient';
  }
  else
  {
	  alert("Data not Updated");
  }
	
}

function editSMSCount(cid,val)
{
	t = prompt("Please enter SMS Credits",val);
	if(!isNaN(t))
	{
		qry = "update tb_clientinfo set ci_smsCount = "+t+" where ci_id = "+cid;		
		ajax1.requestFile = 'ajax_server.php?ajaxQry='+qry;
		//alert(ajax1.requestFile);
		ajax1.onCompletion = function(){resultCount()};
		ajax1.runAJAX();
	}
	else
	{
		alert("Please enter valid integer");
		editSMSCount(cid,val);
	}
}
function redirectUser(uid,cid,rid)
{
	document.frmRedirectUser.txtStudId.value = cid;
	document.frmRedirectUser.ResellID.value = rid;
	document.frmRedirectUser.txtUserId.value = uid;
	document.frmRedirectUser.action = "ajax_server.php";
	document.frmRedirectUser.submit();
}
function callDiffClient(clientType)
{
	document.frmClientType.txtClientType.value = clientType;
	document.frmClientType.submit();
}
function funEditUser(uid,act)
{
	document.frmSubmit.txtStudId.value = uid;
	document.frmSubmit.action = act;
	document.frmSubmit.submit();
}
</script>
<div align="left" class="listofusers">&nbsp;<a href="#" onclick="location.href='?ch=addStudent';">Add New Student</a></div>
<table cellpadding="0" cellspacing="0" border="0" class="gridform_final" id="example">      
	<thead>
    <tr>
        <th width="15%">Student Name</th>
        <th width="10%">Class</th>
        <th width="7%">Roll No</th>
        <th width="7%">RFID</th>
        <th width="15%">Father Name</th> 
        <th width="10%">Primary  Number </th>
        <th width="10%">Alternate Number</th>
        <th width="10%">Email</th>
<!--        <th width="20%">Stop Name</th>-->
        <th width="7%">Edit</th>
   </tr>
   </thead>
   <tbody>
   <?php
	$sql = "SELECT * FROM tb_student_info WHERE si_clientId=".$_SESSION[clientID]." ORDER BY si_firstName ASC";
	$rows = $db->query($sql);

   if($db->affected_rows > 0)
   {
   	while ($record = $db->fetch_array($rows)) 
	{
		/*$getUserACC = "SELECT tgi_name FROM tb_geofence_info WHERE tgi_id = ".$record[si_geoStopId]." ORDER BY tgi_name ASC";
		$rowUserAcc = $db->query($getUserACC);
		if($db->affected_rows > 0)
		{
			$fetUseAcc = $db->fetch_array($rowUserAcc);
			$userName = ucfirst($fetUseAcc[tgi_name]);
		}
		else $userName = "Not Created";*/
	?>
    <tr>
        <td><?php echo ucfirst($record[si_firstName].' '.$record[si_lastName]);?></td>
        <td><?php echo ucfirst($record[si_standard].' '.$record[si_section]);?></td>
        <td><?php echo $record[si_rollNo];?> </td>
        <td><?php echo $record[si_RFIDNo];?> </td>
        <td><?php echo ucfirst($record[si_fatherName]);?></td>
        <td><?php echo $record[si_mobile1];?> </td>
        <td><?php echo $record[si_mobile2];?> </td>
        <td><a href="mailto:<?php echo $record[si_emailId];?>"><?php echo $record[si_emailId];?></a></td>
<!--        <td><?php echo $userName;?></td>-->
        <td><img src="../../images/edit.gif" style="cursor:pointer;" width="45" height="16" border="0"  onclick="funEditUser('<?php echo $record[si_id];?>','?ch=addStudent')" /></td>
   </tr>
   <?php
   	//$avail = 0;
   //}
	}
	}
	else
	{
   ?>
    <tr>
        <td colspan="10"><span>Not data found</span></td>
   </tr>
   <?php
	}
   ?>
	</tbody>
</table>
<form name="frmSubmit" id="frmSubmit" method="post">
	<input type="hidden" name="txtStudId" id="txtStudId" />
</form>
<form name="frmClientType" id="frmClientType" method="post">
	<input type="hidden" name="txtClientType" id="txtClientType" />
</form>
<form name="frmRedirectUser" id="frmRedirectUser" method="post">
	<input type="hidden" name="txtUserId" id="txtUserId" />
    <input type="hidden" name="txtStudId" id="txtStudId" />
    <input type="hidden" name="ResellID" id="ResellID" />
</form>